package teaching.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mapstruct.Mapper;
import teaching.pojo.Homework;
import teaching.pojo.Questions;

import java.util.List;

/**
 * Author:20201002983_郑雨蓓
 * Date: 2024/3/13
 * Description:
 */
@Mapper
public interface QuestionMapper {
    @Select("select * from questions where point_id=#{point_id}")
    List<Questions> SelectByPoint(Long point_id);

    @Select("select * from questions")
    List<Questions> allQuestions();

    @Insert("INSERT INTO questions (content, option1, option2, option3, option4, point_id, answer) " +
            "VALUES (#{newQuestion.content}, #{newQuestion.option1}, #{newQuestion.option2}, #{newQuestion.option3}, #{newQuestion.option4}, #{newQuestion.pointId}, #{newQuestion.answer})")
    int insertQuestion(@Param("newQuestion") Questions newQuestion);

}
